package com.tanhua.model.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;

import java.io.Serializable;
import java.util.Collections;
import java.util.List;

/**
 * @Description: test
 * @Create by: JJ菜菜
 * @Date: 2021/11/30 19:50
 */

@Data
@NoArgsConstructor
@AllArgsConstructor
public class PageResultVo implements Serializable {

    private Integer counts=0;
    private Integer pagesize=10;
    private Integer pages=0;
    private Integer page=1;

    private List<?> items = Collections.emptyList();

    public PageResultVo(Integer page,Integer pagesize,int counts,List list) {
        this.page = page;
        this.pagesize = pagesize;
        this.items = list;
        this.counts = counts;
        this.pages = counts % pagesize == 0 ? counts / pagesize : counts / pagesize + 1;
    }

}
